package com.yanqu.road.server.logic.bag;

import com.yanqu.road.entity.bag.UseGoodsResult;
import com.yanqu.road.entity.config.goods.GoodsInfo;
import com.yanqu.road.entity.enums.eSystemId;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.cookboy.CookBoyMgr;
import com.yanqu.road.server.manger.config.SystemOpenMgr;
import com.yanqu.road.server.protocol.GameErrorCode;

public class UseRecoverCookBoy1HpPower extends BaseUseGoods {

    public UseRecoverCookBoy1HpPower(GamePlayer player, GoodsInfo goodsInfo, long param) {
        super(player, goodsInfo, param);
    }

    @Override
    int checkUse(long count) {
        if(!SystemOpenMgr.systemOpen(player, eSystemId.CookBoyActivity1.getValue())){
            return GameErrorCode.E_SYSTEM_NO_OPEN;
        }
        //拉一下用户数据，防止玩家没有数据还在那使用体力
        int activityId = (int)param;
        CookBoyMgr.getUserCookBoyData(activityId,player);
        return 0;
    }

    @Override
    UseGoodsResult executeUse(long count) {
        int activityId = (int)param;
        CookBoyMgr.recoverHp(activityId,player.getUserId(),count);
        return new UseGoodsResult();
    }
}
